package tanke;

import java.util.Vector;

/**
 * Created by bao on 2017/8/26.
 */
public class Hero extends Tank {

    Vector<Shot> shots = new Vector<Shot>();
    Shot shot = null;

    public Hero(int x, int y, int direct, int type, int speed) {
        super(x, y, direct, type, speed);
    }

    /**
     * 向 1上、2下、3左、4右射击
     */
    public void shot(int x, int y, int direct) {

        switch (direct) {
            case 1:
                shot = new Shot(x + 9, y, direct);
                shots.add(shot);
                break;
            case 2:
                shot = new Shot(x + 9, y + 30, direct);
                shots.add(shot);
                break;
            case 3:
                shot = new Shot(x, y + 10, direct);
                shots.add(shot);
                break;
            case 4:
                shot = new Shot(x + 30, y + 10, direct);
                shots.add(shot);
                break;
        }

        Thread t = new Thread(shot);
        t.start();

    }
}